15. Run Turtlesim

Run Turtlesim

Now that you’ve added ROS’ environment variables to your terminal session, you can run the turtlesim package!

Starting the Master process

Before any ROS nodes can be run, the Master process must be started.

The Master process is responsible for the following (and more)

  • Providing naming and registration services to other running nodes
  • Tracking all publishers and subscribers
  • Aggregating log messages generated by the nodes
  • Facilitating connections between nodes

To run the master process, you must execute the command roscore . If all goes well (and it should), you will see an output similar to following:

This indicates that ROS Master is running. To terminate the ROS Master process, simply send the SIGINT signal to the process by typing ctrl-c in the roscore terminal window.

We are now free to begin launching nodes!

Running Turtlesim Nodes

Now that the ROS master is running, we can run our first two ROS nodes.

To do so, we will execute the rosrun command in a new terminal window, passing as parameters the name of the package we wish to run, and the name of the actual node.

Note:

Tab completion is your friend. Each ROS distribution comes with a staggering number of packages, and an even more staggering number of nodes. In the bash shell, a single-tap of the tab key will cause the command on the command-line to be completed, if there is a single match. A double-tap of the tab key will result in a list of all possible matches, in the case that a single match cannot be found.

First we will start the turtlesim_node , in the turtlesim package using the following command.

$ rosrun turtlesim turtlesim_node

Next, we will start the turtle_teleop_key node , also from the turtlesim package.

$ rosrun turtlesim turtle_teleop_key

By using the arrow keys with the turtle_teleop_key node’s console selected, we are able to move the turtle in turtlesim!